﻿using B.S.DataBase.MyProject.Domain.wdx;
using B.S.DataBase.MyProject.Domain.wdx.ViewModels;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using MedicalPCTerminal.Read.API.Appcation.Commands.ResidentCommand;
using MedicalPCTerminal.Read.API.Appcation.Commands.Sign;
using MedicalPCTerminal.Read.API.Dtos;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MedicalPCTerminal.Read.API.Controllers
{   
    /// <summary>
    /// 签约控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    //[Authorize]
    public class SignController : ControllerBase
    {
        private readonly IMediator mediator;

        public SignController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 获取签约列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<View_SignList>> GetResidentFilesList([FromQuery] GetSignListCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 获取团队信息下拉框
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<View_TeamSlect>>> GetTeamSlect([FromQuery] GetTeamSlectCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 获取医生下拉框
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<View_DoctorSelect>>> GetDoctorSelect([FromQuery] GetDoctorSelectCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 获取服务包数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<ServicesPack>>> GetServicesPack([FromQuery] GetServicesPackCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 获取当前患者的所有绑定的设备信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<SignDeviceBind>>> GetSignDeviceBindList([FromQuery] GetSignDeviceBindCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 根据医生获取患者
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回列表</returns>
        [HttpGet]
        public async Task<APIResult<List<GetPatientByDoctorIdDTO>>> GetPatientByDoctor([FromQuery] GetpatientCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
